package com.cloud.common.config;

import com.cloud.common.feign.FeignProxyClient;
import feign.Client;
import feign.okhttp.OkHttpClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * feign配置类
 *
 * @author fengwenjin
 */
@Configuration
@ConditionalOnMissingClass("com.cloud.gateway.bean.GatewayInfo")
public class FeignConfig {
    @Bean
    public Client feignClient(okhttp3.OkHttpClient client, LoadBalancerClient loadBalancerClient) {
        return new FeignProxyClient(new OkHttpClient(client), loadBalancerClient);
    }
}
